package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.ysd.entity.CompanyInfo;
import com.ysd.util.DBManager;

public class CompanyInfoDaoImpl {
	public CompanyInfo getCompanyInfo() {
		Connection conn = DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;
		CompanyInfo c = null;
		try {
			st = conn.createStatement();
			rs = st.executeQuery("select * from companyinfo");
			while(rs.next()) {
				String name = rs.getString("companyName");
				String webSite = rs.getString("companyWebSite");
				String introduction = rs.getString("companyIntroduction");
				String phone = rs.getString("companyPhone");
				String email = rs.getString("companyEmail");
				String address = rs.getString("companyAddress");
				String culture = rs.getString("companyCulture");
				c = new CompanyInfo(name,webSite,introduction,phone,email,address,culture);
			}
			return c;
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		} finally {
			DBManager.closeAll(conn, st, rs);
		}
		
	}
}
